Attribute VB_Name = "SltVoice"
Option Explicit


Global Const MAX_INDEX_BUFFER_NUM = &H100
Global Const MAX_INDEX_FILE_NUM = &H40
Global Const MAX_FILE_NAME_NUM = &H80

Global Const MAX_CARD_NUM = &H8
Global Const MAX_CHANNEL_NUM = &H40
Global Const MAX_RESOURCE_NUM = &H40
Global Const MAX_SERIAL_NUM = &H20
Global Const MAX_DTMF_NUM = &H40
Global Const MAX_CID_NUM = &H80
Global Const MAX_FSK_NUM = &H400

Global Const MAX_CONFERENCE_GROUP_NUM = &H10
Global Const MAX_CONFERENCE_RESOURCE_NUM = &H20
Global Const MAX_CONFERENCE_GROUP_RESOURCE_NUM = &H10


Global Const BF_OK = &H0
Global Const BF_ERROR = &HFFFF

Global Const CARD_TYPE_NONE = &H0
Global Const CARD_TYPE_VOICE_08 = &H1
Global Const CARD_TYPE_VOICE_08_AC_1 = &H2
Global Const CARD_TYPE_VOICE_08_AC_2 = &H3
Global Const CARD_TYPE_VOICE_16 = &H4

Global Const CHANNEL_TYPE_NONE = &H0
Global Const CHANNEL_TYPE_USER = &H1
Global Const CHANNEL_TYPE_TRUNK = &H2
Global Const CHANNEL_TYPE_RECORD = &H3
Global Const CHANNEL_TYPE_SPECIAL = &H4

Global Const RESOURCE_TYPE_NONE = &H0
Global Const RESOURCE_TYPE_FAX = &H1
Global Const RESOURCE_TYPE_VOIP = &H2
Global Const RESOURCE_TYPE_CODEC = &H4
Global Const RESOURCE_TYPE_FAX_VOIP = &H3
Global Const RESOURCE_TYPE_FAX_CODEC = &H5
Global Const RESOURCE_TYPE_VOIP_CODEC = &H6
Global Const RESOURCE_TYPE_FAX_VOIP_CODEC = &H7

Global Const CONFERENCE_MODE_NONE = &H0
Global Const CONFERENCE_MODE_TALK = &H1
Global Const CONFERENCE_MODE_LISTEN = &H2
Global Const CONFERENCE_MODE_RECORD = &H3


Global Const VOICE_TYPE_A_LAW = &H0
Global Const VOICE_TYPE_ADPCM = &H1
Global Const VOICE_TYPE_G726_32K = &H1
Global Const VOICE_TYPE_G726_16K = &H2
Global Const VOICE_TYPE_G728 = &H3
Global Const VOICE_TYPE_G729A = &H4
Global Const VOICE_TYPE_G729B = &H5
Global Const VOICE_TYPE_G723_53K = &H6
Global Const VOICE_TYPE_G723_63K = &H7

Global Const VOICE_FILE_TYPE_NORMAL = &H0
Global Const VOICE_FILE_TYPE_WAVE = &H1

Global Const FAX_RESOLUTION_LOW = &H0
Global Const FAX_RESOLUTION_FINE = &H1

Global Const CHANNEL_STATUS_IDLE = &H1
Global Const CHANNEL_STATUS_OPEN = &H2
Global Const CHANNEL_STATUS_PLAY = &H4
Global Const CHANNEL_STATUS_RECORD = &H8
Global Const CHANNEL_STATUS_GENERATE_DTMF = &H10
Global Const CHANNEL_STATUS_SEND_FSK = &H20
Global Const CHANNEL_STATUS_GENERATE_SIGNAL = &H40
Global Const CHANNEL_STATUS_DETECT_SIGNAL = &H80
Global Const CHANNEL_STATUS_SEND_FAX = &H100
Global Const CHANNEL_STATUS_RECEIVE_FAX = &H200
Global Const CHANNEL_STATUS_VOIP = &H400
Global Const CHANNEL_STATUS_AUTO_DIAL_OUT = &H800


Global Const STOP_NOT_DTMF = &H0
Global Const STOP_ANY_DTMF = &H1


Global Const MESSAGE_HAVE_CID_FSK = &H0
Global Const MESSAGE_HAVE_CID_DTMF = &H1
Global Const MESSAGE_HAVE_DTMF = &H2
Global Const MESSAGE_PLAY_VOICE_END = &H3
Global Const MESSAGE_PLAY_VOICE_EXIT = &H4
Global Const MESSAGE_RECORD_VOICE_END = &H5
Global Const MESSAGE_RECORD_VOICE_EXIT = &H6
Global Const MESSAGE_GENERATE_SIGNAL_END = &H7
Global Const MESSAGE_GENERATE_SIGNAL_EXIT = &H8
Global Const MESSAGE_GENERATE_DTMF_END = &H9
Global Const MESSAGE_SEND_FSK_END = &HA
Global Const MESSAGE_HAVE_DIAL_TONE = &HB
Global Const MESSAGE_HAVE_BUSY_TONE = &HC
Global Const MESSAGE_HAVE_BACK_TONE = &HD
Global Const MESSAGE_HAVE_TONE_DATA = &HE
Global Const MESSAGE_HAVE_HELLO_VOICE = &HF
Global Const MESSAGE_HAVE_SILENCE_DATA = &H10
Global Const MESSAGE_HAVE_BACK_TONE_HALT = &H11
Global Const MESSAGE_HAVE_SPECIAL_SIGNAL = &H12
Global Const MESSAGE_HAVE_FSK_DATA = &H13
Global Const MESSAGE_HAVE_TIME_OUT = &H14

Global Const MESSAGE_PLAY_CIRCLE_FIRST_END = &H15
Global Const MESSAGE_PLAY_CIRCLE_SECOND_END = &H16
Global Const MESSAGE_RECORD_CIRCLE_FIRST_END = &H17
Global Const MESSAGE_RECORD_CIRCLE_SECOND_END = &H18

Global Const MESSAGE_AUTO_DIAL_NO_DIAL_TONE = &H19
Global Const MESSAGE_AUTO_DIAL_NONE_LISTEN = &H1A
Global Const MESSAGE_AUTO_DIAL_HAVE_BUSY = &H1B
Global Const MESSAGE_AUTO_DIAL_HOOK_OFF = &H1C
Global Const MESSAGE_AUTO_DIAL_HOOK_OFF_BY_HELLO = &H1D
Global Const MESSAGE_AUTO_DIAL_HOOK_OFF_BY_POLE = &H1E

Global Const MESSAGE_USER_HOOK_OFF = &H1001
Global Const MESSAGE_USER_HOOK_ON = &H1002
Global Const MESSAGE_USER_PICK_UP = &H1003
Global Const MESSAGE_USER_RING_END = &H1004

Global Const MESSAGE_TRUNK_RING = &H2000
Global Const MESSAGE_TRUNK_POLE = &H2001
Global Const MESSAGE_TRUNK_PICK_UP_END = &H2002

Global Const MESSAGE_RECORD_OPEN_CIRCLE = &H3001
Global Const MESSAGE_RECORD_NO_OPEN_CIRCLE = &H3002
Global Const MESSAGE_RECORD_HOOK_OFF = &H3004
Global Const MESSAGE_RECORD_HOOK_ON = &H3005
Global Const MESSAGE_RECORD_RING = &H3006
Global Const MESSAGE_RECORD_RING_END = &H3007

Global Const MESSAGE_FAX_SEND_OK = &H5000
Global Const MESSAGE_FAX_SEND_ERROR = &H5001
Global Const MESSAGE_FAX_RECEIVE_OK = &H5002
Global Const MESSAGE_FAX_RECEIVE_ERROR = &H5003
Global Const MESSAGE_FAX_REMOTE_TEL_NO = &H5004
Global Const MESSAGE_FAX_INFORMATION = &H5005

Global Const MESSAGE_FAX_SEND_PAGE_END = &H500A
Global Const MESSAGE_FAX_RECEIVE_PAGE_END = &H500B

Global Const MESSAGE_FAX_SEND_PAGE_START = &H500C
Global Const MESSAGE_FAX_RECEIVE_PAGE_START = &H500D


' Define message struct for all voice card
Type BF_MESSAGE_INFO
    MessageCode     As Integer
    ChannelNo       As Integer
    Parameter(6)    As Integer
End Type

Type BF_TONE_INFO
        DialToneMinTotalTime    As Integer          ' Max Signal All times By MilliSecond, default :2500

        BusyToneMaxTotalTime    As Integer          ' Max Signal All times By MilliSecond, default :1500
        BusyToneMinTotalTime    As Integer          ' Min Signal All times By MilliSecond, default :500
        BusyToneRatio           As Integer          ' Ratio(%)(On Times/All Times), default :50
        BusyToneErrorBetweenTwo As Integer          ' Error between Ratio (%), default :10
        BusyToneTotalTimes      As Integer          ' Total Times, default :3

        BackToneMaxTotalTime    As Integer          ' Max Signal All times By MilliSecond, default :6000
        BackToneMinTotalTime    As Integer          ' Min Signal All times By MilliSecond, default :4000
        BackToneRatio           As Integer          ' Ratio(%)(On Times/All Times), default :20
        BackToneErrorBetweenTwo As Integer          ' Error between Ratio (%), default :10
        BackToneTotalTimes      As Integer          ' Total Times, default :2
End Type

Type BF_FAX_INFORMATION
        SignalRate      As Integer
        Resolution      As Integer
        TwoDimensional  As Integer
        RecordWidth     As Integer
        RecordLength    As Integer
End Type


'----------------------------------------------------
'      BfVoice  BfVoice.dll API Function
'----------------------------------------------------
Declare Function BF_InitializeSystem Lib "BfVoice.dll" () As Integer
Declare Function BF_CloseSystem Lib "BfVoice.dll" () As Integer

Declare Function BF_GetTotalCard Lib "BfVoice.dll" () As Integer
Declare Function BF_GetCardSerialNo Lib "BfVoice.dll" (ByVal CardNo As Integer, ByRef SerialNo As String) As Integer
Declare Function BF_SetCardUserID Lib "BfVoice.dll" (ByVal CardNo As Integer, ByVal Password As String, ByVal PasseordLength As Integer, ByVal userId As String) As Integer
Declare Function BF_GetCardUserID Lib "BfVoice.dll" (ByVal CardNo As Integer, ByRef Password As String, ByVal PasseordLength As Integer, ByVal userId As String) As Integer

Declare Function BF_GetTotalChannel Lib "BfVoice.dll" () As Integer
Declare Function BF_GetChannelType Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetChannelStatus Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_OpenChannel Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_OpenSpecialChannel Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_CloseChannel Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopChannelOperate Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_GetMessage Lib "BfVoice.dll" (ByVal WaitTime As Integer, ByRef MessageBuffer As BF_MESSAGE_INFO) As Integer
Declare Function BF_CheckMessage Lib "BfVoice.dll" (ByVal WaitTime As Integer, ByRef MessageBuffer As BF_MESSAGE_INFO) As Integer
Declare Function BF_PostMessage Lib "BfVoice.dll" (ByRef pMessageBuffer As BF_MESSAGE_INFO) As Integer

Declare Function BF_ListenChannel Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal SourceChannel As Integer) As Integer
Declare Function BF_UnListenChannel Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_LinkChannel Lib "BfVoice.dll" (ByVal FirstChannelNo As Integer, ByVal SecondChannelNo As Integer) As Integer
Declare Function BF_UnLinkChannel Lib "BfVoice.dll" (ByVal FirstChannelNo As Integer, ByVal SecondChannelNo As Integer) As Integer

Declare Function BF_UserRingOn Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal RingOnTime As Integer, ByVal RingOffTime As Integer, ByVal TotalTimes As Integer) As Integer
Declare Function BF_UserRingOff Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_SetUserPickUpTime Lib "BfVoice.dll" (ByVal TimeByMilliSecond As Integer) As Integer

Declare Function BF_TrunkHookOff Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_TrunkHookOn Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartDetectTrunkPolarity Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectTrunkPolarity Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartTrunkPickUp Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TimeByMilliSecond As Integer) As Integer
Declare Function BF_StopTrunkPickUp Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_StartTimeOut Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TimeBySecond As Integer) As Integer
Declare Function BF_StopTimeOut Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_SetTimeOutValue Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TimeBySecond As Integer) As Integer

Declare Function BF_SetVoiceBufferNum Lib "BfVoice.dll" (ByVal MaxVoiceBufferNum As Long) As Integer

Declare Function BF_StartPlayFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StartPlayBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Buffer As Byte, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StopPlayVoice Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetPlayLength Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef PlayLength As Long) As Integer

Declare Function BF_InitPlayIndexFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_AddPlayIndexFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_StartPlayIndexFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal StopChar As Byte) As Integer

Declare Function BF_InitPlayIndexBuffer Lib "BfVoice.dll" () As Integer
Declare Function BF_AddPlayIndexBuffer Lib "BfVoice.dll" (ByRef Buffer As Byte, ByVal Length As Long) As Integer
Declare Function BF_StartPlayIndexBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef IndexTable As Integer, ByVal IndexCount As Integer, ByVal StopChar As Byte) As Integer

Declare Function BF_StartPlayCircleBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef Buffer As Byte, ByVal TotalLength As Long, ByVal StopChar As Byte) As Integer

Declare Function BF_StartRecordFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StartRecordBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef Buffer As Byte, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StopRecordVoice Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetRecordLength Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef RecordLength As Long) As Integer
Declare Function BF_StartRecordCircleBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef Buffer As Byte, ByVal TotalLength As Long, ByVal StopChar As Byte) As Integer

Declare Function BF_StartPlayAdpcmFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StartRecordAdpcmFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer

Declare Function BF_SetVoiceType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal VoiceType As Integer) As Integer
Declare Function BF_SetPlayVoiceType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal VoiceType As Integer) As Integer
Declare Function BF_SetRecordVoiceType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal VoiceType As Integer) As Integer
Declare Function BF_StartPlayFileByVoiceType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StartRecordFileByVoiceType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer

Declare Function BF_SetPlayVoiceFileType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileType As Integer) As Integer
Declare Function BF_SetRecordVoiceFileType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileType As Integer) As Integer
Declare Function BF_StartPlayFileByFileType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer
Declare Function BF_StartRecordFileByFileType Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String, ByVal Offset As Long, ByVal Length As Long, ByVal StopChar As Byte) As Integer

Declare Function BF_StartDetectDTMF Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal SmartLevel As Integer) As Integer
Declare Function BF_StopDetectDTMF Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_ClearDTMFBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetDTMFKey Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFCount As Integer, ByRef DTMFString As Byte) As Integer
Declare Function BF_CheckHitDTMF Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GenerateDTMFString Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef DTMFString As Byte) As Integer

Declare Function BF_AutoDialOut Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFString As String) As Integer
Declare Function BF_AutoDialOutWithHello Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFString As String) As Integer
Declare Function BF_AutoDialOutWithPole Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFString As String) As Integer

Declare Function BF_StartGenerateSignal Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency0 As Integer, ByVal Frequency1 As Integer, ByVal OnTime As Integer, ByVal OffTime As Integer, ByVal TotalTimes As Integer, ByVal StopChar As Byte) As Integer
Declare Function BF_StopGenerateSignal Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_SetDetectToneInfo Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef ToneInfo As BF_TONE_INFO) As Integer
Declare Function BF_SetToneFrequency Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency As Integer) As Integer
Declare Function BF_SetDetectDialToneFrequency Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency As Integer) As Integer
Declare Function BF_SetDetectBackToneFrequency Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency As Integer) As Integer
Declare Function BF_SetDetectBusyToneFrequency Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency As Integer) As Integer

Declare Function BF_StartDetectDialTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectDialTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartDetectBackTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectBackTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartDetectBackToneStop Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal StopTimeByMs As Integer) As Integer
Declare Function BF_StopDetectBackToneStopLib Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartDetectBusyTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectBusyTone Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StartDetectToneData Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectToneData Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_StartDetectHelloVoice Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectHelloVoice Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_SetDetectHelloVoiceThreshold Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal ThresholdValue As Integer) As Integer

Declare Function BF_StartDetectSilence Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectSilence Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_SetSpecialSignalFrequency Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Frequency As Integer) As Integer
Declare Function BF_StartDetectSpecialSignal Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TimeByMilliSecond As Integer) As Integer
Declare Function BF_StopDetectSpecialSignal Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_StartDetectCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetRawFskCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef CallerIDString As Byte) As Integer
Declare Function BF_GetFskCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal DateTime As String, ByVal TelNo As String, ByVal Name As String) As Integer

Declare Function BF_StartDetectDtmfCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopDetectDtmfCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_GetDtmfCallerID Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TelNo As String) As Integer

Declare Function BF_StartSendFsk Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal SeizureFlag As Integer, ByRef Buffer As Byte, ByVal Count As Integer) As Integer
Declare Function BF_StopSendFsk Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer

Declare Function BF_ConferenceAddMember Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Mode As Integer, ByVal Group As Integer) As Integer
Declare Function BF_ConferenceDelMember Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Mode As Integer, ByVal Group As Integer) As Integer
Declare Function BF_ConferenceAddMemberWithGain Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Mode As Integer, ByVal Group As Integer, ByVal Gain As Integer) As Integer


Declare Function BF_InitTTS Lib "BfVoice.dll" () As Integer
Declare Function BF_CloseTTS Lib "BfVoice.dll" () As Integer
Declare Function BF_TTSFileToFile Lib "BfVoice.dll" (ByVal TextFileName As String, ByVal VoiceFileName As String) As Integer
Declare Function BF_TTSBufferToBuffer Lib "BfVoice.dll" (ByVal TextBuffer As String, ByVal TextCount As Long, ByVal VoiceBuffer As String, ByRef VoiceCount As Long) As Integer
Declare Function BF_TTSBufferToFile Lib "BfVoice.dll" (ByVal TextBuffer As String, ByVal TextCount As Long, ByVal VoiceFileName As String) As Integer


Declare Function BF_AlawToWave Lib "BfVoice.dll" (ByVal AlawFileName As String, ByVal WaveFileName As String) As Integer
Declare Function BF_WaveToAlaw Lib "BfVoice.dll" (ByVal WaveFileName As String, ByVal AlawFileName As String) As Integer
Declare Function BF_AlawToAdpcm Lib "BfVoice.dll" (ByVal AlawFileName As String, ByVal AdpcmFileName As String) As Integer
Declare Function BF_AdpcmToAlaw Lib "BfVoice.dll" (ByVal AdpcmFileName As String, ByVal AlawFileName As String) As Integer


Declare Function BF_G711ToG726 Lib "BfVoice.dll" (ByVal G711FileName As String, ByVal G726FileName As String, ByVal G726VoiceType As Integer) As Integer
Declare Function BF_G726ToG711 Lib "BfVoice.dll" (ByVal G726FileName As String, ByVal G726VoiceType As Integer, ByVal G711FileName As String) As Integer


Declare Function BF_GetTotalResource Lib "BfVoice.dll" () As Integer
Declare Function BF_GetResourceType Lib "BfVoice.dll" (ByVal ResourceNo As Integer) As Integer

Declare Function BF_OpenResource Lib "BfVoice.dll" (ByVal ResourceNo As Integer, ByVal ResourceType As Integer) As Integer
Declare Function BF_CloseResource Lib "BfVoice.dll" (ByVal FaxChannelNo As Integer) As Integer

Declare Function BF_BindResource Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal ResourceNo As Integer) As Integer
Declare Function BF_FreeResource Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal ResourceNo As Integer) As Integer

Declare Function BF_InitFaxFunction Lib "BfVoice.dll" () As Integer
Declare Function BF_CloseFaxFunction Lib "BfVoice.dll" () As Integer
Declare Function BF_SetFaxLocalTelNo Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal LocalTelNo As String) As Integer
Declare Function BF_GetFaxRemoteTelNo Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal RemoteTelNo As String) As Integer
Declare Function BF_GetFaxInformation Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef FaxInformation As BF_FAX_INFORMATION) As Integer
Declare Function BF_GetFaxPageNo Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
' One Line Max byte is 106
' Must use 0x0A to end the current line, Buffer content cann't have 0x0D
Declare Function BF_SendFaxTxtBuffer Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal TxtBuffer As String, ByVal BufferCount As Integer) As Integer
Declare Function BF_SendFaxTxtFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_SendBitFaxFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_SendTiffFaxFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_ReceiveBitFaxFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_ReceiveTiffFaxFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FileName As String) As Integer
Declare Function BF_StopFaxOperate Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
' Send three BitFax File Function, Max File Num is Three, connected by "+"
Declare Function BF_SendMultiBitFaxFile Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Directory As String, ByVal FileName As String) As Integer
' Call Function BF_SetFaxResolution must before BF_Send/ReceiveFax... and after BF_OpenResource
Declare Function BF_SetFaxResolution Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FaxResolution As Integer) As Integer
Declare Function BF_GetFaxResolution Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef FaxResolution As Integer) As Integer

Declare Function BF_SetFaxHeader Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal FaxFrom As String, ByVal FaxTo As String, ByVal FaxNo As String, ByVal FaxSubject As String, ByVal DateTime As String) As Integer
Declare Function BF_SendBitFaxFileWithPageNo Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal StartPageNo As Integer, ByVal EndPageNo As Integer, ByVal FileName As String) As Integer

Declare Function BF_BitFaxToTiff Lib "BfVoice.dll" (ByVal BitFaxFile As String, ByVal TiffFile As String) As Integer
Declare Function BF_TiffToBitFax Lib "BfVoice.dll" (ByVal TiffFile As String, ByVal BitFaxFile As String) As Integer


Declare Function BF_ReadVoicePacket Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Buffer As String) As Integer
Declare Function BF_WriteVoicePacket Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Buffer As String) As Integer


' Next Functions Only Used By VoIP Card
Declare Function BF_StartVoipOperate Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_StopVoipOperate Lib "BfVoice.dll" (ByVal ChannelNo As Integer) As Integer
Declare Function BF_ReadVoipPacket Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Buffer As String) As Integer
Declare Function BF_WriteVoipPacket Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal Buffer As String) As Integer

Declare Function BF_SetRecordVolumeGain Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal VolumeGain As Integer) As Integer
Declare Function BF_GetRecordVolumeGain Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef VolumeGain As Integer) As Integer
Declare Function BF_SetPlayVolumeGain Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal VolumeGain As Integer) As Integer
Declare Function BF_GetPlayVolumeGain Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByRef VolumeGain As Integer) As Integer


Declare Function BF_LinkVoiceAndVoIP Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal ResourceNo As Integer) As Integer
Declare Function BF_UnLinkVoiceAndVoIP Lib "BfVoice.dll" (ByVal ChannelNo As Integer, ByVal ResourceNo As Integer) As Integer


Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long


